/**
 * @author[wengcj]
 * @version[创建日期，2021/11/2 9:55]
 * @function[功能简介 ]
 **/
package com.example.myapplication;

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity

class SecondAct: AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val secondButton = Button(this)
        secondButton.text = "second"
        secondButton.setOnClickListener {
            val intent = Intent()
            intent.putExtra("data", "data from SecondActivity")
            setResult(RESULT_OK, intent)
            finish()
        }
        val linearLayout = LinearLayout(this)
        linearLayout .addView(secondButton)
        setContentView(linearLayout)
    }
}